# -*- coding: utf-8 -*-

# $Id: model_introspection.py 2 2012-09-01 15:54:17Z alexis.roda.villalonga@gmail.com $

class ModelIntrospector(object):
    """
    """

    def __init__(self, model):
        """Constructor.

        :param model:
        """
        self._model = model

    def get_field_names(self):
        return self._model._meta.get_all_field_names()

    def get_pk_field(self):
        return self._model._meta.pk

    def get_fields(self, omitpk=False):
        for field in self._model._meta.fields:
            if not (omitpk and field.primary_key):
                yield field
